﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork2_4
{
    public interface IShape
    {
        double getSquare();//计算面积
        bool iflegal();//判断是否合法
    }
    public class Shape
    {
        double square;//面积
    }
    public class Rectangle:Shape,IShape
    {
        public double width;
        public double height;
        public double angle;
        public double getSquare()
        {
            return width * height;
        }
        public bool iflegal()
        {
            return angle == 90;
        }
    }
    public class Square : Shape, IShape
    {
        public double side;
        public double angle;
        public double getSquare()
        {
            return side * side;
        }
        public bool iflegal()
        {
            return angle == 90;
        }
    }
    public class triangle : Shape, IShape
    {
        public double side1;
        public double side2;
        public double side3;
        public double heightOfSide1;//边1的高
        public double getSquare()
        {
            return side1 * heightOfSide1;
        }
        public bool iflegal()
        {
            return (side1+side2>side3)&&(side1+side3>side2)&&(side2+side3>side1);
        }
    }
    internal class Program
    {
        static void Main(string[] args)
        {
        }
    }
}
